package com.doubi.model.sys;

import java.util.Date;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.doubi.utils.DataUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 后台权限表
 *
 * @author MrDoubi123
 * @since 2019-10-20
 */
@Data
@Accessors(chain = true)
@TableName("t_sys_permission")
@EqualsAndHashCode(callSuper = true)
public class TSysPermission extends Model<TSysPermission> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "oid", type = IdType.UUID)

    private String oid;


    @Override
    protected Serializable pkVal() {
        return this.oid;
    }

    /**
     * 标题
     */

    private String title;


    /**
     * 父级oid
     */
    @TableField("parent_id")

    private String parentId;


    /**
     * 祖级列表
     */

    private String ancestors;


    /**
     * 链接
     */

    private String url;


    /**
     * 1链接2权限
     */

    private Integer type;


    /**
     * 权限
     */

    private String permission;


    /**
     * 头像
     */
    @TableField("icon_class")

    private String iconClass;


    @TableField("create_time")

    private Date createTime;


    /**
     * 创建者
     */
    @TableField("create_by")

    private String createBy;


    /**
     * 更新时间
     */
    @TableField("update_time")

    private Date updateTime;


    /**
     * 创建者
     */
    @TableField("update_by")

    private String updateBy;


    /**
     * 排序
     */
    @TableField("sort_num")

    private Integer sortNum;


    /**
     * 备注
     */

    private String remark;



    //不是表字段
    @TableField(exist = false)
    private Integer selected;


    public boolean getSelected() {
        if(DataUtil.isEmpty(selected)){
            return false;
        }
        return selected == 1;
    }


}